<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <head th:replace="common/head"/>
</head>
<body>
<div class="x-body">
    <form class="layui-form" style="padding-bottom: 10px;text-align: left;">
        <div class="layui-form-item">
            客户：
            <div class="layui-inline">
                <select name="customerId" lay-search="">
                    <option value="">直接选择或搜索选择</option>
                    <th:block th:each="map: ${customerList}">
                        <option th:value="${map.userId}" th:text="${map.userName}"></option>
                    </th:block>
                </select>
            </div>
            取回者：
            <div class="layui-inline">
                <select name="deliveryId" lay-search="">
                    <option value="">直接选择或搜索选择</option>
                    <th:block th:each="map: ${deliverList}">
                        <option th:value="${map.userId}" th:text="${map.userName}"></option>
                    </th:block>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            订单时间起：
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <input type="text" name="beginDate" lay-verify="myCheckDate" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input layDate">
                </div>
            </div>
            止：
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <input type="text" name="endDate" lay-verify="myCheckDate" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input layDate">
                </div>
            </div>
            <button class="layui-btn" lay-submit lay-filter="query"><i class="layui-icon">&#xe615;</i></button>
        </div>
    </form>
    <blockquote id='showDelivery' class="layui-elem-quote layui-quote-nm">请点击上方按钮查询</blockquote>

</div>
<div th:replace="common/js"></div>
<div th:replace="common/setting"></div>
<script type="text/javascript">
    layui.use('xtable');
    layui.use(['layer', 'form'], function(){
        let $ = layui.jquery,
            form = layui.form;
        form.on('submit(query)', function(data){
            let values = data.field;
            $.get('/statistics/getSumDelivery', values, function (result) {
                if (result.code == 0) {
                    layer.msg(result.msg, {
                        icon: 1,
                        time: 1000
                    });
                    $("#showDelivery").html("查询条件下的配送费合计："+(result.data?result.data:0));
                } else {
                    layer.msg(result.msg, {
                        icon: 2,
                        time: 5000
                    });
                    $("#showDelivery").html("");
                }
            });
            return false;
        });
    });
</script>
</body>
</html>
